<% @page_title = "#{@user.login} | 多背一公斤 - 灾后学校重建计划" %>

<% content_for(:sidebar) do %>
  <%= render :partial => 'intro', :locals => {:user => @user} %>
  <br />
  <% if current_user==:false || current_user.id!=@user.id -%>
    <%= link_to "给#{@user.login}发消息", new_message_url(:to => @user.id) %>
  <% end -%>
  
  <p><%= button_to "加为我的友邻", add_user_path(@user.id) if @user.addable?(current_user) %></p>
  
  <h2>我的友邻 &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp;
    <span class="h2l">(<%= link_to "全部友邻", neighbors_user_path(@user.id) %>)</span></h2>
  <%= render :partial => "/shared/users", :object => @neighbors %>
  <% if logged_in? && current_user.id == @user.id -%>
    <h2><%= link_to "#{@who_add_me[0].count} 人加我为友邻", who_add_me_user_path(@user.id) %></h2>
  <% end -%>
<% end %>

<h1><%= @user.login %></h1>

<h2>我上传的照片 &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp;</h2>
<div id="photos">
  <% if @photos.empty? -%>
    <span class="tip">还没有</span>
  <% else -%>
    <% @photos.each do |photo| %>
      <%= link_to image_tag(photo.public_filename(:small)), photo_url(photo.id) %>
    <% end %>
  <% end -%>
</div>

<h2>我参加的活动 &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp;
  <span class="h2l">(<%= link_to "我发布的活动", published_events_user_url(@user.id) %>)</span></h2>
<% @events.each do |event| -%>
  <%= render :partial => "/events/event", :object => event %>
<% end -%>